import { createBrowserRouter, Navigate } from 'react-router-dom'
import type { RouteObject } from 'react-router-dom'

import Login from '../views/router-nest/Login'
import Layout from '../views/router-nest/Layout'
import Employee from '../views/router-nest/Employee'
import Salary from '../views/router-nest/Salary'
import Index from '../views/redux-base/Index'
import ReactRedux from '../views/react-redux/Index'
import NotFound from '../views/router-base/NotFound'

const routes: RouteObject[] = [
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/layout',
    element: <Layout />,
    children: [
      { path: 'employee', element: <Employee /> },
      { path: 'salary', element: <Salary /> }
    ]
  },
  {
    path: '/',
    element: <Navigate to='/login' />
  },
  {
    path: '/redux-base',
    element: <Index />
  },
  {
    path: '/react-redux',
    element: <ReactRedux />
  },
  {
    path: '*',
    element: <NotFound />
  }
]

const router = createBrowserRouter(routes)

export default router
